﻿using DC2010.Objects.Data;
using DC2010.Objects.Info;
using DC2010.Objects.Structures;
using DC2010.Objects.Base;
using System.Collections.Generic;
using DC2010.Objects.Common;

namespace DC2010.Objects.Logic
{
    public class ActionLogic : BaseLogic
    {
        public ActionLogic(ActionData id)
        {
            Info = new ActionInfo();
            Gfx = new ActionGfx();
            Data = id;
        }

        public ActionInfo Info { get; set; }
        public ActionGfx Gfx { get; set; }
		
		public void DoAction(CreatureData attacker)
		{
			//public List<KeyValue> Effects { get; set; }	
            List<BaseObject> ownedObjects = Root.I.GameSystem.GetOwnedObjects(Data.Id);

            foreach (KeyValue kv in ((ActionData)Data).Effects)
            {
				// kv.value is effect id
				EffectData ed = Root.I.EffectSystem.GetData(kv.Value);
				
				// we are attacking with this Action parameters
				// for example attack action SWING:
				// this action will have associated one effect - ACTION_SWING_EFFECT
				ed.L.Instant(Data, attacker);
            }
		}
    }
}
